/* Path definition structure */
#include <stdio.h>
#include <stdlib.h>

/* path is a sequence of events, and paths is a set of paths*/
#include "prefix_tree.h"
#include "itf_debug.h"
#include "mex.h"

/* Create the DLL funtions to manipulate the path data structures */
GEN_DLINKEDLIST_FUNCTIONS(dll_path, path_l, path_n, path_el);

void path_debug(path_l *pl, path_n *node) {
    
    DEBUG_PRINT((FDEBUG, "-> (Event: %d, Pp: %p, Pclk: %f, Pnode: %p, Nid: %d) ", node->data.ev_id, node, node->data.clk, node->data.t_node, node->data.t_node->nid));
    node = node->next;
    
    for(;node != NULL;) {
        if(node->data.t_node != NULL)
            DEBUG_PRINT((FDEBUG, "-> (Event: %d, Pp: %p, Pclk: %f, Pnode: %p, Nid: %d) ", node->data.ev_id, node, node->data.clk, node->data.t_node, node->data.t_node->nid));
        
        if(node->data.t_node == NULL)
            mexErrMsgTxt("The path mapping is incorrect.");
        
        node = node->next;
    }
    
    DEBUG_PRINT((FDEBUG, "| %d\n", pl->n));
}
